package com.iwomy.secureplat.platform.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iwomy.secureplat.platform.entity.BasicVideoModelEntity;
import com.iwomy.secureplat.platform.mapper.BasicVideoModelMapper;
import com.iwomy.secureplat.platform.service.BasicVideoModelService;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 视频类设备型号表
 *
 * @author pig
 * @date 2024-02-18 15:21:10
 */
@Service
public class BasicVideoModelServiceImpl extends ServiceImpl<BasicVideoModelMapper, BasicVideoModelEntity> implements BasicVideoModelService {

	@Override
	public Page getBasicVideoModelPage(Page page, BasicVideoModelEntity basicVideoModel) {
		LambdaQueryWrapper<BasicVideoModelEntity> wrapper = Wrappers.lambdaQuery();

		if (StrUtil.isNotEmpty(basicVideoModel.getProviderName())) {
			wrapper.like(BasicVideoModelEntity::getProviderName, basicVideoModel.getProviderName());
		}

		return baseMapper.selectPage(page, wrapper);
	}

	@Override
	public List<BasicVideoModelEntity> getBasicVideoModelList(BasicVideoModelEntity basicVideoModel) {
		LambdaQueryWrapper<BasicVideoModelEntity> wrapper = Wrappers.lambdaQuery(basicVideoModel);
		wrapper.eq(BasicVideoModelEntity::getState, 10);
		return this.baseMapper.selectList(wrapper);
	}

}